﻿using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

public class ResourceManager : MonoBehaviour {

    private QuestionPool questionPool1;
    private QuestionPool questionPool2;
    public bool BeReady = false;
    public static ResourceManager Instance;
    // Use this for initialization
    void Awake () {
        StartCoroutine(Init());
        Instance = this;
    }

    public QuestionPool GetQuestionPool(int id)
    {
        if(id == 1)
        {
            return questionPool1;
        }
        else
        {
            return questionPool2;
        }
    }

    IEnumerator Init()
    {
        WWW www = new WWW(Application.streamingAssetsPath + "/题库1.csv");
        yield return www;
        questionPool1 = QuestionPool.Parse(Encoding.UTF8.GetString(www.bytes));
        www = new WWW(Application.streamingAssetsPath + "/题库2.csv");
        yield return www;
        questionPool2 = QuestionPool.Parse(Encoding.UTF8.GetString(www.bytes));
        BeReady = true;
    }
}
